#include <bits/stdc++.h>
using namespace std;
int x[100005],y[100005];
int k;
void marge_sort(int left,int right)
{
	if (left >= right)
		return;
	int mid = (left + right)/2;
	marge_sort(left,mid);
	marge_sort(mid+1,right);
	
	int i = left,j = mid +1;
	int t = left;
	while(i <= mid && j <= right)
	{
		if (x[i] <= x[j])
		{
			y[t++] = x[i++];
		}
		else
		{
			y[t++] = x[j++];
			k += mid - i +1;
		}
	}
	while(i <= mid)
		y[t++] = x[i++];
	while(j <= right)
		y[t++] = x[j++];
	for (i = left; i <= right; i++)
	{
		x[i] = y[i];
	}
	
}

int main()
{
	int n;
	cin >> n;
	for (int i = 1 ; i <= n; i++)
	{
		cin >> x[i];
	}
	marge_sort(1,n);
	cout << k;
	
	return 0;
}
